
	<div class="block">

<div id= 'content'>
	<h2>相册管理</h2>
	
	<?php
	
	if(!$_POST['p']){
		$p='index';
	$current= $imgManage['index'];
	}else{
		$p=$_POST['p'];
		$current= $imgManage[$p];
	}
	$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 100000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("../images/index/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "../images/index/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "../images/index/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }	
	
	
 
  //echo "<pre>",print_r($dirlist),"</pre>";
  
	?>
	
<form action="" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /> 
<br />
<input type="submit" name="submit" value="Submit" />
</form>
<form action="" method="post">
	  <label>页面选择</label>
                 <select id="p" name="p" >
<?php
foreach($imgManage as $key=>$value){
	?>
	    <option><?php echo $key?></option>

	
	
	
	<?php
}
?>

</select>
<input type="submit" name="submit" value="Submit" />

</form>
	  <p>当前页面：<?php echo $p;?></p>

	<table class='contentTable' border="1">
			<tr>
		<td>name</td>
		<td>type</td>
		<td>size</td>
		<td>lastmod</td>
		<td>belongTo</td>
		<td>path</td>
		<td>display</td>
		</tr>
		<?php
	
	foreach($current as $dir){
	
	?>
	<tr>
		<td><?php echo $dir['name'];?></td>
		<td><?php echo $dir['type'];?></td>
		<td><?php echo $dir['size']/1024;?></td>
		<td><?php echo $dir['lastmod'];?></td>
		<td><?php echo "index";?></td>
		<td><?php echo $dir['path'];?></td>
		<td><img src=<?php echo "\"".$dir['path']."\"";?> alt="" width="120px"></td>
		
	</tr>
	<?php
	
	}
	
	?>
		


		</table>
	</div>
	</div>